
local function _count(array)
    if next(array) == nil then
        return 0
    else
        return 1 + _count(table.move(array, 2, #array, 1, {}))
    end
end

local function test()
    local arr = {}
    for i=1, 5 do
        arr[#arr+1] = i
    end

    local c = _count(arr)
    assert(c == #arr)
end

test()

